<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
	<div class="t_bar">
	单位现有科研设施与仪器情况汇总表（金额：万元）
	<input type="hidden" id="eq_tab2_val" name="equipment2s/eq_tab2_val" value="<x:out select="$xmlData/data/equipment2s/eq_tab2_val"/>"></div>
		<table  id="eq_table2" cellpadding="0" class="t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
		<col style="width:5%"/>
		<col style="width:5%"/>
		<col style="width:10%"/>
		<col style="width:10%"/>
		<col style="width:10%"/>
		<col style="width:10%"/>
		<col style="width:10%"/>
		<col style="width:20%"/>
		<col style="width:10%"/>
		<col style="width:15%"/>
		<thead >
			<tr style="border:1px solid #B7D1E6">
				<th class="TblHead" align="center"  >选择</th>
				<th class="TblHead" align="center"  >序号</th>
				<th class="TblHead" align="center"  >仪器名称</th>
				<th class="TblHead" align="center"  >厂商</th>
				<th class="TblHead" align="center"  >产地</th>
				<th class="TblHead" align="center"  >型号</th>
				<th class="TblHead" align="center"  >原值</th>
				<th class="TblHead" align="center"  >启用日期</th>
				<th class="TblHead" align="center"  >上年度使用<br/>时数</th>
				<th class="TblHead" align="center"  >是否加入省级平台开放共享</th>
			</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name="selMileStones" >
						</td>
						<td align="center">
							<span name="equipment2s|equipment2[0]@seq_no" >[index]</span> 
						</td>
						<td align="center">
							<input type="text" name="equipment2s|equipment2[0]|sname" class="input_css  required" style="width:80%" label="仪器名称" value="" maxlength="100"/>
						</td>
						<td align="center">
							<input type="text" name="equipment2s|equipment2[0]|stroe" class="input_css  required" style="width:80%" label="厂商" value="" maxlength="100"/>
						</td>
						<td align="center">
							<input type="text" name="equipment2s|equipment2[0]|address_stroe" class="input_css  required" style="width:80%" label="产地" value="" maxlength="100"/>
						</td>
						
						<td align="center">
							<input type="text"  name="equipment2s|equipment2[0]|model"  class="input_css required " style="width:80%;" label="型号" maxlength="100" />
						</td>
						<td align="center">
							<input type="text" name="equipment2s|equipment2[0]|raw_num" class="input_css  required" style="width:80%" label="原值" value="" maxlength="100"/>
						</td>
						<td align="center">
							<input type="text" name="equipment2s|equipment2[0]|start_date" class="input_css required date" style="width:60%" label="启用日期" value=""/>
						</td>
						<td align="center">
							<input type="text" name="equipment2s|equipment2[0]|use_num" class="input_css required" style="width:80%" label="上年度使用时数" value="" maxlength="100"/>
						</td>
						
						<td align="center">
							<input type="text"  name="equipment2s|equipment2[0]|flag_join"  class="input_css required" style="width:80%;" maxlength="100"  label="是否加入省级平台开放共享" />
						</td>	
					</tr>
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/equipment2s/equipment2" var="equipment2">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr >
						<td>&nbsp;
							<input type="radio" class="radiobutton" name="selMileStones" >
							<input type="hidden" name="equipment2s|equipment2[${flag}${index}]@type" value="other"/>
						</td>
						
						<td align="center">
							<span   name="equipment2s/equipment2[${flag}${index}]@seq_no" ><x:out select="$equipment2/@seq_no"/></span> 
						</td>
						
						<td align="center">
							<input type="text" name="equipment2s/equipment2[${flag}${index}]/sname" value="<x:out select="$equipment2/sname" />" class="input_css  required" style="width:80%" label="仪器名称 " maxlength="100"/>
						</td>
						<td align="center">
							<input type="text" name="equipment2s/equipment2[${flag}${index}]/stroe" class="input_css required" style="width:80%" label="厂商" value="<x:out select="$equipment2/stroe"/>" maxlength="100"/>
						</td>
						<td align="center">
							<input type="text" name="equipment2s/equipment2[${flag}${index}]/address_stroe" class="input_css required" style="width:80%" label="产地" value="<x:out select="$equipment2/address_stroe"/>" maxlength="100"/>
						</td>
						
						<td align="center">
							<input type="text" name="equipment2s/equipment2[${flag}${index}]/model" class="input_css required " style="width:80%;" label="型号"  value="<x:out select="$equipment2/model"/>" maxlength="100" />
						</td>
						<td align="center">
							<input type="text" name="equipment2s/equipment2[${flag}${index}]/raw_num" value="<x:out select="$equipment2/raw_num" />" class="input_css required" style="width:80%" label="原值 " maxlength="100"/>
						</td>
						<td align="center">
							<input type="text" name="equipment2s/equipment2[${flag}${index}]/start_date" class="input_css required date" style="width:60%" label="启用日期" value="<x:out select="$equipment2/start_date"/>"/>
						</td>
						<td align="center">
							<input type="text" name="equipment2s/equipment2[${flag}${index}]/use_num" class="input_css required" style="width:80%" label="上年度使用时数" value="<x:out select="$equipment2/use_num"/>" maxlength="100"/>
						</td>
						
						<td align="center">
							<input type="text" name="equipment2s/equipment2[${flag}${index}]/flag_join"  class="input_css  required" style="width:80%;" label="是否加入省级平台开放共享"  value="<x:out select="$equipment2/flag_join"/>" maxlength="100" />
						</td>
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					<script type="text/javascript">
						showAllDateTag("eq_table2");
					</script>
					</x:forEach>
				</tbody>
					</table>
					<%-- <table id="tota2" class="t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
						<col style="width: 735px"/>
						
						<tr>
							<td align="center">合计：</td>
							
							<td align="center">
								<input type="text" name="equipments/total_price2" id="total_price2" onfocus="InitInput.setNumber(this,9,2,2)" class="hn_iuput_kuang1   maxlength:50 gray" style="width:80%; text-align: right;"  disabled="disabled" value="<x:out select="$xmlData/data/equipments/total_price2"/>" maxlength="50" />
							</td>
							
						</tr>
					
					</table> --%>
					<table width="98%" align="center">
							<tr >
								<td>
									<input class="button_02" name="cmdAddbefore" type=button value="添加" onclick="if(checkTabLimit('eq_table2',999,'单位现有科研设施与仪器情况汇总表最多只能填写999条')){addNewRow('eq_table2');showDateTag('eq_table2');}try{top.resizeFrame();}catch(e){};checkTab2();changeCss();count()">
									<input class="button_02" name="cmdMovePrev" type=button value="上移" onclick="movePrev('eq_table2','selMileStones');changeCss()">
									<input class="button_02" name="cmdMoveNext" type=button value="下移" onclick="moveNext('eq_table2','selMileStones');changeCss()">
									<input class="button_02" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('eq_table2','单位现有科研设施与仪器情况汇总表');checkTab2();changeCss();count()">
								</td>
							</tr>
					</table>
					<p>注：仅填写单台套价值30万元及以上的大型科学仪器设备</p>
<script type="text/javascript">
	$(function() {
		count();
		changeCss();
	});
	function count() {
		/* $("#total_price1").val(0);
		$("#total_num1").val(0);
		var numall1=0;
		$("#eq_table1 tr:gt(1)").each(function() {
			var price_each=$(this).find("td:eq(4) input").val();
			var num=$(this).find("td:eq(5) input").val();
			if(!!!price_each){
				price_each="0";
			}
			if(!!!num){
				num="0";
			}
			$(this).find("td:eq(6) input").val(formatVal(price_each*num));
			$("#total_price1").val(formatVal(parseFloat($("#total_price1").val())+parseFloat($(this).find("td:eq(6) input").val())));
			numall1=parseFloat(numall1)+parseFloat(num);
		});
		$("#total_num1").val(numall1);
		
		
		$("#total_num2").val(0); */
		/* var numall2=0; */
		$("#total_price2").val(0);
		$("#eq_table2 tr:gt(1)").each(function() {
			var moneys=$(this).find("td:eq(5) input").val(); 
			
			/* var num=$(this).find("td:eq(5) input").val(); */
			 if(!!!moneys){
				moneys="0";
			} 
			
			/* $(this).find("td:eq(6) input").val(formatVal(price_each*num)); */
			$("#total_price2").val(formatVal(parseFloat($("#total_price2").val())+parseFloat($(this).find("td:eq(5) input").val())));
			
			/* numall2=parseFloat(numall2)+parseFloat(num); */
		});
		
		/* $("#total_num2").val(numall2); */
	}
	function formatVal(count) {
		if (!$.isNumeric(count))
		count = "0";
		count = ((parseFloat(count) * 10000) / 10000).toFixed(4);
		count = formatNumberAuto(count.toString(), 9, 4, 2);// 格式化金额
		return count;
	}
	function checkTab2() {
		if($("#eq_table2 tr").length>2){
	    	$("#eq_tab2_val").val("1");
	    }else{
	    	$("#eq_tab2_val").val("");
	    }
	}
	function changeCss() {
		$("table.t_css").each(function(){
			$(this).find("tr:even").removeClass().addClass("li_1");
			$(this).find("tr:odd").removeClass().addClass("li_2");
		});
		changeCss1("eq_table1","total1");
		changeCss1("eq_table2","total2");
	}
	function changeCss1(id1,id2) {
		if($("#"+id1+" tr:last").attr("class")=="li_1"){
			$("#"+id2+" tr").removeClass("li_1").addClass("li_2");
		}else{
			$("#"+id2+" tr").removeClass("li_2").addClass("li_1");
		}
	}
	 function countFundAuto(idStart, countStr, totalStr) {
	 		var indexs = countStr.split(",");
	 		var count = 0;
	 		for ( var i = 0; i < indexs.length; i++) {
	 			var fund = $("#" + idStart + indexs[i]).val();
	 			
	 			if (!$.isNumeric(fund))
	 				fund = "0";
	 			count = ((parseFloat(count)*10000 + parseFloat(fund)*10000)/10000).toFixed(4);
	 			
	 		}
	 		
	 		
	 		count = formatNumberAuto(count.toString(), 9, 4, 2);// 格式化金额
	 		
	 		//add by cg 扩展：对于多个输入框所求得的和，同时赋给某几个文本框
	 		var totalStrArr = totalStr.split(",");
	 		var totalId;
	 		for(var i = 0;i < totalStrArr.length; i++ ) {
	 			totalId = totalStrArr[i];
	 		
	 		$("#" + idStart + totalId).val(count);
	 		}
	 	}
</script>										
		
					
	
